{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Natural Disasters\n",
    "-----------------\n",
    "This example shows a visualization of global deaths from natural disasters.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "import altair as alt\n",
    "alt.data_transformers.enable('json')\n",
    "from altair.expr import datum\n",
    "from vega_datasets import data\n",
    "\n",
    "source = data.disasters.url\n",
    "\n",
    "alt.Chart(source).mark_circle(\n",
    "    opacity=0.8,\n",
    "    stroke='black',\n",
    "    strokeWidth=1\n",
    ").encode(\n",
    "    alt.X('Year:O', axis=alt.Axis(labelAngle=0)),\n",
    "    alt.Y('Entity:N'),\n",
    "    alt.Size('Deaths:Q',\n",
    "        scale=alt.Scale(range=[0, 5000]),\n",
    "        legend=alt.Legend(title='Annual Global Deaths')\n",
    "    ),\n",
    "    alt.Color('Entity:N', legend=None)\n",
    ").properties(\n",
    "    width=480,\n",
    "    height=350\n",
    ").transform_filter(\n",
    "    datum.Entity != 'All natural disasters'\n",
    ")\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "env": {},
   "interrupt_mode": "signal",
   "language": "python",
   "metadata": {},
   "name": "python3"
  },
  "language": "python"
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
